package br.com.ordersys.web.mail;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

public class MailMessage {
	private String from;
	private List<String> recipientList;
	private String mimeType;
	private String messageText;
	private List<Attachment> attachments;
	private String subject;
	private String replyTo;

	public MailMessage() {
		recipientList = new ArrayList<String>();
		attachments = new ArrayList<MailMessage.Attachment>();
	}

	public void addRecipientTo(String to) {
		recipientList.add(to);
	}

	public void addAttachment(String name, InputStream data, String mimeType) {
		Attachment att = new Attachment();
		att.data = data;
		att.mimeType = mimeType;
		att.fileName = name;

		attachments.add(att);
	}

	public List<Attachment> getAttachments() {
		return attachments;
	}

	public List<String> getRecipientsTo() {
		return recipientList;
	}

	public String getFrom() {
		return from;
	}

	public void setFrom(String from) {
		this.from = from;
	}

	public String getMimeType() {
		return mimeType;
	}

	public void setMimeType(String mimeType) {
		this.mimeType = mimeType;
	}

	public String getMessageText() {
		return messageText;
	}

	public void setMessageText(String messageText) {
		this.messageText = messageText;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public static class Attachment {
		private String fileName;
		private String mimeType;
		private InputStream data;

		public String getFileName() {
			return fileName;
		}

		public String getMimeType() {
			return mimeType;
		}

		public InputStream getData() {
			return data;
		}
	}

	public String getReplyTo() {
		return replyTo;
	}

	public void setReplyTo(String replyTo) {
		this.replyTo = replyTo;
	}
}
